﻿@using Fly.Domain.Models;
@model Fly.Domain.Models.User
@{
    ViewBag.Title = Model.Nickname + "的主页";
    Layout = "~/Views/Shared/_LayoutPage.cshtml";

    var myPosts = ViewBag.MyPosts as IList<Post>;
    var myAnswers = ViewBag.MyAnswers as IList<Comment>;
}


<div class="fly-home" style="background-image: url();">
    <img src="@Model.HeadPortrait" alt="@Model.Nickname">
    <h1>
        @Model.Nickname
        @if (Model.Gender == Gender.Man)
        {
            <i class="iconfont icon-nan"></i>
        }
        else
        {
            <i class="iconfont icon-nv"></i>
        }
        <!-- <i class="iconfont icon-nv"></i> -->
        <!-- <span style="color:#c00;">（超级码农）</span>
        <span style="color:#5FB878;">（活雷锋）</span>
        <span>（该号已被封）</span> -->
    </h1>
    <div class="layui-main">
        <p style="display: inline-block; max-width: 800px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #999; margin-top: 10px;">
            @Model.Sign
        </p>
    </div>
    <!--<div class="fly-sns">
      <span lay-event="">添加好友</span>
    </div>-->
</div>

<div class="main layui-clear">
    <div class="fly-main layui-clear">

        <div class="home-nav">
            <a href="#">主页</a>
            <!--<a href="">求解</a>-->
        </div>
        <div class="home-left">
            <h2>最近发表的求解</h2>
            <ul class="jie-row">
                @if (myPosts != null && myPosts.Count > 0)
                {
                    foreach (var item in myPosts)
                    {
                        <li>
                            @if (item.IsBoutique)
                            {
                                <span class="fly-jing">精</span>
                            }
                            @if (item.PostStatus == PostStatus.Close)
                            {
                                <span class="jie-status jie-status-ok">已解决</span>
                            }
                            else
                            {
                                <span class="jie-status">求解中</span>
                            }
                            <a href="@Url.Action("Detail", "Post", new { postId = item.Id })">@item.Title</a>
                            <i>@item.TimeAgo</i>
                            <em>@(item.Hits)阅/@(item.CommentCount)答</em>
                        </li>
                    }
                }
                else
                {
                    <li class="fly-none" style="min-height: 50px; padding:30px 0; height:auto;"><i style="font-size:14px;">没有发表任何求解</i></li>
                }
            </ul>

            <h2 style="margin-top:30px;">最近的回答</h2>
            <ul class="home-jieda">
                @if (myAnswers != null && myAnswers.Count > 0)
                {
                    foreach (var item in myAnswers)
                    {
                        <li>
                            <p>
                                <span>@item.TimeAgo</span>
                                在<a href="@Url.Action("Detail", "Post", new { postId = item.PostId })" target="_blank">@item.Post.Title</a>中回答：
                            </p>
                            <div class="home-dacontent">
                                @item.Content
                            </div>
                        </li>
                    }
                }
                else
                {
                     <li class="fly-none" style="min-height: 50px; padding:30px 0; height:auto;"><span>没有回答任何问题</span></li> 
                }
                
            </ul>
        </div>
        <div class="home-right">
            <ul class="home-info">
                <li><i class="iconfont icon-zuichun"></i>拥有飞吻：<span style="color: #FF7200;">@Model.Integral</span></li>
                <li><i class="iconfont icon-shijian"></i>加入时间：<span>@Model.CreateTime.ToString("yyyy-MM-dd")</span></li>
                <li><i class="iconfont icon-chengshi"></i>城市：<span>@Model.City</span></li>
            </ul>
        </div>
    </div>
</div>

